package com.example.beaven.news.model.net.repository;

import com.example.beaven.news.model.bean.NewsResult;
import com.example.beaven.news.model.net.api.ApiService;
import com.example.beaven.news.utils.RxUtil;
import io.reactivex.Flowable;
import javax.inject.Inject;

/**
 * @author : Beaven
 * @time : 2017/12/9 14:31
 */

public class HttpRepository implements HttpHelper {

  private final ApiService apiService;

  @Inject
  public HttpRepository(ApiService apiService) {
    this.apiService = apiService;
  }

  @Override
  public Flowable<NewsResult> getNews(String type) {
    return apiService.getNews(type)
        .compose(RxUtil.transformerResult())
        .compose(RxUtil.rxSchedulerHelper());
  }
}
